﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Auxiliaries
{
    /// <summary>
    /// A form accepting user input for OMX section names
    /// </summary>
    public partial class AuxQueryBox : Form
    {
        /// <summary>
        /// Selects the input that should be used with the dialog box, and updates the UI accordingly
        /// </summary>
        public enum IfModeSel
        {
            /// <summary>
            /// Parameter section creation mode
            /// </summary>
            Section_create,
            /// <summary>
            /// Component instance mode force set mode
            /// </summary>
            Component_instance,
            /// <summary>
            /// Component port number query
            /// </summary>
            Comp_port_number,
            /// <summary>
            /// Go to line number query
            /// </summary>
            Go_To_Line
        }
        /// <summary>
        /// Public constructor
        /// </summary>
        /// <param name="mode">Input mode selection</param>
        public AuxQueryBox(IfModeSel mode)
        {
            InitializeComponent();

            inputModeInit(mode);
        }
        /// <summary>
        /// Public constructor
        /// </summary>
        /// <param name="mode">Input mode selection</param>
        /// <param name="initVal">Initial field value</param>
        public AuxQueryBox(IfModeSel mode, string initVal)
        {
            InitializeComponent();

            inputModeInit(mode);

            tbQueryInputText.Text = initVal;
        }

        void inputModeInit(IfModeSel mode)
        {
            switch (mode)
            {
                case IfModeSel.Section_create:
                    break;
                case IfModeSel.Component_instance:
                    Text = "Set component instance id";
                    lblQueryDescription.Text = "Component instance id:";
                    tbQueryInputText.Text = "-1";
                    break;
                case IfModeSel.Comp_port_number:
                    Text = "Set component port(s) number";
                    lblQueryDescription.Text = "Component(s) port number:";
                    tbQueryInputText.Text = "-1";
                    break;
                case IfModeSel.Go_To_Line:
                    Text = "Go to line";
                    lblQueryDescription.Text = "Go to line number:";
                    tbQueryInputText.Text = "0";
                    break;
                default:
                    break;
            }
        }
        /// <summary>
        /// Returns the user input string for the section name
        /// </summary>
        /// <returns>section name</returns>
        public string GetInputText()
        {
            return tbQueryInputText.Text;
        }
    }
}
